package com.chaidb;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.db.DbConnection;

public class GetAMarker {
	
	@SuppressWarnings("finally")
	public MyMarker doGetMarker(String markername,String userid)
	{
		String sql = "select * from marker where markername='"+
		markername +"'&& userid='" +userid+"';";
		Connection con = null;
		MyMarker marker =  new MyMarker();
		try {
			con = DbConnection.getInstance().getConnection();
			Statement st = con.createStatement();
			ResultSet rs = st.executeQuery(sql);
			if(rs.next())
			{
				marker.id = rs.getString("id");
				marker.creater = rs.getString("creater");
				marker.createtime = rs.getString("createtime");
				marker.description = rs.getString("description");
				marker.latitude = rs.getString("latitude");
				marker.longitude = rs.getString("longitude");
				marker.markername = rs.getString("markername");
				marker.musicurl = rs.getString("musicurl");
				marker.state = rs.getString("state");
				marker.type = rs.getString("type");
			}
		}catch(SQLException e)
		{
			e.printStackTrace();
		}finally{
			return marker;
		}
	}
}
